<?php

/*
Files :          eventsFile.php, (require ConfFile.php)
Name :           Derived class for manipulation with events.conf ("Events-File ver. (0.11)")
Version :        1.2
Release :        30. 1. 2007
Descript :       Derived class for manipulation with events.conf ("Events-File ver. (0.11)")
                 derived form ConfFile

Functions:
     Derived form ConfFile class :
        public function GetData()
        public function Open($filename)
        public function Close()
        public function Load()
        public function AddItem($block,$parametr,$value)
        public function EditItem($block, $item, $index, $new_value)
        public function DeleteItem($block, $item, $index)
        public function AddBlock($block)
        public function DeleteBlock($block)
        public function RenameBlock($block, $newblock)

     New functions in class:
        public function FindFile($text)      -> returns information about command or false

*/

require_once ('inc/ConfFile.php');
class eventsFile extends ConfFile {
	public function __construct($filename = "n/a") {
		parent :: __construct($filename);
	}

	public function FindFile($text) /* returns information about command */ {
		if (strpos($text, " ")) {
			$prikaz = substr($text, 0, strpos($text, " ")); //z celeho textu si to vytahne prikaz (byva prvni slovo)
			if (substr($prikaz, 0, 1) == "!") {
				$prikaz = substr($prikaz, 1, strlen($prikaz));
			} //pokud je prvni znak !... odmazne ho to
		} else {
			if (substr($text, 0, 1) == "!") {
				$prikaz = substr($text, 1, strlen($text));
			} else {
				$prikaz = $text;
			}
		}
		foreach ($this->Data as $block => $hodnota) {
			if ($block == $prikaz) {
				//shoda... je to spravy prikaz
				return $this->Data[$block]; //vrati pole s obsahem celeho bloku... muze se to hodit pri zpracovani
				//pokud to budu chtit potom volat tak $neco[item][cislo] - cislo je vetsinou 0, je to tam pro pripad ze by bylo vic stejnym itemu
			}
		}
		return false;
	}
}
?>